<template>
  <div>
    <card v-if="$store.state.superAdmin == 'true'" style="margin-bottom: 10px">
      <el-select
        style="width: 100%"
        v-model="museumId"
        @change="
          getReservationConfig();
          getAppMuseumExtraConfig();
        "
        filterable
      >
        <el-option
          v-for="item in museumList"
          :key="item.id"
          :label="item.name"
          :value="item.id"
        >
        </el-option>
      </el-select>
    </card>

    <Spin fix size="large" v-if="spinShow1"></Spin>

    <el-tabs type="border-card">
      <el-tab-pane label="预约基础配置">
        <Form ref="form" :model="data" :label-width="160">
          <div class="fixed">
            <FormItem label="是否开启当天预约：" class="formitem">
              <div style="display: flex; align-items: center">
                <i-switch v-model="data.enableAppointmentThatDay" size="large">
                  <span slot="open">开启</span>
                  <span slot="close">关闭</span>
                </i-switch>
                <Tooltip
                  max-width="400"
                  content="关闭后当天不可预约当天的入馆场次，仅可预约第二天之后的场次"
                  placement="bottom"
                >
                  <Icon
                    style="margin-left: 10px; margin-top: 7px"
                    size="20"
                    type="ios-help-circle-outline"
                  />
                </Tooltip>
              </div>
            </FormItem>
            <FormItem label="是否开启身份校验：" class="formitem">
              <div style="display: flex; align-items: center">
                <i-switch
                  v-model="data.mustFillIdCard"
                  size="large"
                  @on-change="changeEnable"
                >
                  <span slot="open">开启</span>
                  <span slot="close">关闭</span>
                </i-switch>
                <Tooltip
                  max-width="400"
                  content="身份校验是指游客预约时是否需提供身份信息"
                  placement="bottom"
                >
                  <Icon
                    style="margin-left: 10px; margin-top: 7px"
                    size="20"
                    type="ios-help-circle-outline"
                  />
                </Tooltip>
              </div>
            </FormItem>
            <FormItem label="全国健康码的校验：" class="formitem">
              <div style="display: flex; align-items: center">
                <i-switch
                  v-model="data.healthCodeFlag"
                  size="large"
                  @on-change="changeHealthCodeFlag"
                >
                  <span slot="open">开启</span>
                  <span slot="close">关闭</span>
                </i-switch>
                <Tooltip
                  max-width="400"
                  content="健康码校验是指游客预约时是否检查健康码"
                  placement="bottom"
                >
                  <Icon
                    style="margin-left: 10px; margin-top: 7px"
                    size="20"
                    type="ios-help-circle-outline"
                  />
                </Tooltip>
              </div>
            </FormItem>
            <FormItem
              label="浙江省健康码校验："
              v-if="data.showProvinceHealthCodeFlag"
              class="formitem"
            >
              <div style="display: flex; align-items: center">
                <i-switch
                  v-model="data.provinceHealthCodeFlag"
                  size="large"
                  @on-change="changeProvinceHealth"
                >
                  <span slot="open">开启</span>
                  <span slot="close">关闭</span>
                </i-switch>
                <Tooltip
                  max-width="400"
                  content="关闭后，将不校验是否有浙江省健康码（全国健康码权重大于浙江省健康码，即如果全国健康码和浙江省健康码同时打开，系统将会先判断是否有全国健康码，后判断是否有浙江省健康码，两者只要有一个有绿码即可）"
                  placement="bottom"
                >
                  <Icon
                    style="margin-left: 10px; margin-top: 7px"
                    size="20"
                    type="ios-help-circle-outline"
                  />
                </Tooltip>
              </div>
            </FormItem>
            <FormItem label="是否开启多次入园：" class="formitem">
              <div style="display: flex; align-items: center">
                <i-switch
                  v-model="data.multipleEnterFlag"
                  size="large"
                  @on-change="changeMultipleEnterFlag"
                >
                  <span slot="open">开启</span>
                  <span slot="close">关闭</span>
                </i-switch>
                <Tooltip
                  max-width="400"
                  content="多次入园是指游客一次预约是否可以使用多次"
                  placement="bottom"
                >
                  <Icon
                    style="margin-left: 10px; margin-top: 7px"
                    size="20"
                    type="ios-help-circle-outline"
                  />
                </Tooltip>
              </div>
            </FormItem>
            <FormItem label="是否开启留言回复：" class="formitem">
              <div style="display: flex; align-items: center">
                <i-switch
                  v-model="data.leaveFlag"
                  size="large"
                  @on-change="changeLeaveFlag"
                >
                  <span slot="open">开启</span>
                  <span slot="close">关闭</span>
                </i-switch>
                <Tooltip
                  max-width="400"
                  content="关闭后，留言模块将关闭"
                  placement="bottom"
                >
                  <Icon
                    style="margin-left: 10px; margin-top: 7px"
                    size="20"
                    type="ios-help-circle-outline"
                  />
                </Tooltip>
              </div>
            </FormItem>
            <!-- <FormItem label="是否开启防疫行程卡：" class="formitem">
              <div style="display: flex; align-items: center">
                <i-switch v-model="data.travelCheckFlag" size="large">
                  <span slot="open">开启</span>
                  <span slot="close">关闭</span>
                </i-switch>
                <Tooltip
                  max-width="400"
                  content="开启后，单人最多预约一人，游客接收并填写行程码后，将在预约“我的绿码”页面展示通讯大数据行程卡信息"
                  placement="bottom"
                >
                  <Icon
                    style="margin-left: 10px; margin-top: 7px"
                    size="20"
                    type="ios-help-circle-outline"
                  />
                </Tooltip>
              </div>
            </FormItem> -->
            <FormItem label="自动预约开关：" class="formitem">
              <div style="display: flex; align-items: center">
                <i-switch v-model="data.autoBookSwitch" size="large">
                  <span slot="open">开启</span>
                  <span slot="close">关闭</span>
                </i-switch>
                <Tooltip
                  max-width="400"
                  content="开启后，当游客通过核验设备刷身份证或社保卡时，如无预约信息，将自动进行预约并进行核验。"
                  placement="bottom"
                >
                  <Icon
                    style="margin-left: 10px; margin-top: 7px"
                    size="20"
                    type="ios-help-circle-outline"
                  />
                </Tooltip>
              </div>
            </FormItem>
            <FormItem label="是否允许自主核销：" class="formitem">
              <div style="display: flex; align-items: center">
                <i-switch v-model="data.selfCheckSwitch" size="large">
                  <span slot="open">开启</span>
                  <span slot="close">关闭</span>
                </i-switch>
                <Tooltip
                  max-width="400"
                  content="开启后，将会允许用户 自主核销"
                  placement="bottom"
                >
                  <Icon
                    style="margin-left: 10px; margin-top: 7px"
                    size="20"
                    type="ios-help-circle-outline"
                  />
                </Tooltip>
              </div>
            </FormItem>
            <FormItem label="同一场次重复预约：" class="formitem">
              <div style="display: flex; align-items: center">
                <i-switch v-model="data.repeatBookSwitch" size="large">
                  <span slot="open">开启</span>
                  <span slot="close">关闭</span>
                </i-switch>
                <Tooltip
                  max-width="400"
                  content="开启后，当天同一场次将会允许重复预约"
                  placement="bottom"
                >
                  <Icon
                    style="margin-left: 10px; margin-top: 7px"
                    size="20"
                    type="ios-help-circle-outline"
                  />
                </Tooltip>
              </div>
            </FormItem>

            <FormItem label="核酸凭证上传通道开关：" class="formitem">
              <div
                style="display: flex; align-items: center"
                @click="nucleicSwitch"
              >
                <i-switch v-model="gonggaoData.nucleicSwitch" size="large">
                  <span slot="open">开启</span>
                  <span slot="close">关闭</span>
                </i-switch>
              </div>
            </FormItem>
            <FormItem class="formitem" label="团队预约配置：">
              <Button
                type="success"
                size="large"
                style="width: 50%"
                @click="showmeteam"
                :loading="spinShow2"
              >配置
              </Button
              >
            </FormItem
            >

            <el-dialog
              title="团队预约配置"
              :visible.sync="FormVisible"
              :modal-append-to-body="false"
            >
              <FormItem label="闭馆日期：">
                <DatePicker
                  transfer
                  :clearable="false"
                  :options="options"
                  :confirm="false"
                  @on-change="changeDates"
                  type="date"
                  multiple
                  :editable="false"
                  size="large"
                  placeholder="请选择闭馆日期"
                  style="width: 50%"
                  v-model="closeDate3"
                ></DatePicker>
              </FormItem>
              <FormItem label="团队预约需要提前天数：" style="width: 33%">
                <InputNumber
                  :max="1000"
                  :min="0"
                  v-model="teamAdvanceDays"
                ></InputNumber>
              </FormItem>
              <FormItem label="团队预约功能：">
                <RadioGroup v-model="extraconfig.openTeamAppointment" type="button">
                  <Radio label="开启"></Radio>
                  <Radio label="关闭"></Radio>
                </RadioGroup>
                <Tooltip
                  max-width="400"
                  content="开启后，可选择进行团队预约，通过上传指定团队人员信息表或分享填写信息后进行预约"
                  placement="bottom"
                >
                  <Icon
                    style="margin-left: 10px; margin-top: 7px"
                    size="20"
                    type="ios-help-circle-outline"
                  />
                </Tooltip>
              </FormItem>
              <FormItem
                label="团队预约限制："
                v-if="extraconfig.openTeamAppointment == '开启'"
              >
                <div style="display: flex; align-items: center">
                  <p>人数下限：</p>
                  <InputNumber
                    :min="1"
                    v-model="extraconfig.teamLimitMin"
                    style="width: 300px"
                  ></InputNumber>
                  <Tooltip
                    max-width="400"
                    content="每个团队预约人数限制"
                    placement="bottom"
                  >
                    <Icon
                      style="margin-left: 10px; margin-top: 7px"
                      size="20"
                      type="ios-help-circle-outline"
                    />
                  </Tooltip>
                </div>
                <div style="display: flex; align-items: center; margin-top: 10px">
                  <p>人数上限：</p>
                  <InputNumber
                    :min="1"
                    v-model="extraconfig.teamLimitMax"
                    style="width: 300px"
                  ></InputNumber>
                </div>
              </FormItem>
              <div style="display: flex; width: 1220px">
                <FormItem
                  label="团队预约短信通知："
                  v-if="extraconfig.openTeamAppointment == '开启'"
                  style="width: 1200px"
                >
                  <Input
                    v-model="extraconfig.notifyPhone"
                    style="width: 300px"
                    @blur.native.capture="aaa"
                    placeholder="请输入手机号"
                  ></Input>

                  <RadioGroup
                    v-model="extraconfig.teamNotifySwitch"
                    type="button"
                  >
                    <Radio label="开启"/>
                    <Radio label="关闭"/>
                  </RadioGroup>
                  <Tooltip
                    max-width="900"
                    content="开启并填写指定接收团队通知的手机号码，在有团队预约后将向指定号码发送短信通知。"
                    placement="bottom"
                  >
                    <Icon
                      style="margin-left: 10px; margin-top: 7px"
                      size="20"
                      type="ios-help-circle-outline"
                    />
                  </Tooltip>
                </FormItem>
              </div>

              <FormItem
                label="预约讲解服务："
                v-if="extraconfig.openTeamAppointment == '开启'"
              >
                <RadioGroup v-model="extraconfig.hasCommentService" type="button">
                  <Radio label="开启"></Radio>
                  <Radio label="关闭"></Radio>
                </RadioGroup>
                <Tooltip
                  max-width="700"
                  content="开启后，游客进行团队预约时可勾选是否预约讲解服务，如游客有该需求，指定接收团队通知的手机号码将接收到相应的预约讲解通知，请接收人在收到预约通知后务必安排好对应讲解服务。"
                  placement="bottom"
                >
                  <Icon
                    style="margin-left: 10px; margin-top: 7px"
                    size="20"
                    type="ios-help-circle-outline"
                  />
                </Tooltip>
              </FormItem>
              <FormItem
                label="简易团队预约："
                v-if="extraconfig.openTeamAppointment == '开启'"
              >
                <RadioGroup v-model="extraconfig.simpleTeamBookSwitch" type="button">
                  <Radio label="开启"></Radio>
                  <Radio label="关闭"></Radio>
                </RadioGroup>
                <!-- 开启后只需要团队名称、团队发起人姓名、团队发起人手机号、团队人数这四个字段 -->
                <Tooltip
                  max-width="700"
                  content="【谨慎开启】开启后，文旅绿码系统将不再校验团队游客身份和健康码信息，可无需填写团队内每个人的信息快捷完成预约。馆方如有管理需求，可选择通过上传自定义团体参观登记表，并要求入馆时携带来留存参观人员信息。"
                  placement="bottom"
                >
                  <Icon
                    style="margin-left: 10px; margin-top: 7px"
                    size="20"
                    type="ios-help-circle-outline"
                  />
                </Tooltip>
              </FormItem>

              <!-- <FormItem>
                <el-upload
                  class="upload-demo"
                  action="https://museum-voice.bowu66.com/stage/reservation/uploadMuseumAttachment"
                  multiple
                  :limit="1"
                  :data="uploadData"
                  :headers="uploadheaders"
                  :file-list="fileList"
                >
                  <el-button size="small" type="primary"
                    >点击上传团体参观登记表</el-button
                  >
                </el-upload>
              </FormItem> -->
              <div slot="footer" class="dialog-footer">
                <el-button @click="FormVisible = false">取 消</el-button>
                <el-button type="primary" @click="quedingteam">确 定</el-button>
              </div>
            </el-dialog>
          </div>
          <div class="fixed">
            <FormItem label="单人预约最多人数：" style="width: 33%">
              <InputNumber
                :max="1000"
                :min="1"
                v-model="data.singleLimit"
              ></InputNumber>
              <Tooltip
                max-width="400"
                content="单人可协助预约的最大人数设置"
                placement="bottom"
              >
                <Icon
                  style="margin-left: 10px; margin-top: 7px"
                  size="20"
                  type="ios-help-circle-outline"
                />
              </Tooltip>
            </FormItem>
            <FormItem label="提前核销（分钟）：" style="width: 33%">
              <InputNumber
                :min="0"
                v-model="data.showAdvanceTime"
              ></InputNumber>
              <Tooltip
                max-width="400"
                content="填写提前核销的分钟数，当游客到馆时间提前于预约场次时间，并在提前核销范围内，可核销入馆，设置范围为0~240分钟，不可设置跨日。"
                placement="bottom"
              >
                <Icon
                  style="margin-left: 10px; margin-top: 7px"
                  size="20"
                  type="ios-help-circle-outline"
                />
              </Tooltip>
            </FormItem>
            <FormItem label="核销延时（分钟）：" style="width: 33%">
              <InputNumber :min="0" v-model="data.checkDelay"></InputNumber>
              <Tooltip
                max-width="400"
                content="填写核销延时的分钟数，当游客到馆时间晚于预约场次时间，并在核销延时时间范围内，可核销入馆，设置范围为0~240分钟，不可设置跨日。"
                placement="bottom"
              >
                <Icon
                  style="margin-left: 10px; margin-top: 7px"
                  size="20"
                  type="ios-help-circle-outline"
                />
              </Tooltip>
            </FormItem>
          </div>

          <!-- <FormItem label="闭馆设置：">
			        	<Select transfer multiple v-model="data.closeWeek" style="width:300px" placeholder="设置周几闭馆" >
			        		<template v-for="item in list">
			        			<Option :value="item.value">{{item.label}}</Option>
			        		</template>
			        	</Select>
			        </FormItem> -->

          <FormItem label="预约成功页提示语：">
            <div style="display: flex">
              <Input
                style="width: 900px"
                v-model="updateBookSuccessTops"
              ></Input>
              <el-popover placement="bottom" width="380" trigger="hover">
                <div>
                  <img
                    src="../../assets/image/预约成功页提示语.jpg"
                    alt=""
                    width="350"
                    height="736"
                  />
                </div>
                <div slot="reference">
                  <Icon
                    style="margin-left: 15px; margin-top: 7px"
                    size="20"
                    type="ios-help-circle-outline"
                  />
                </div>
              </el-popover>
            </div>
          </FormItem>

          <FormItem label="闭馆日期：">
            <DatePicker
              transfer
              :clearable="false"
              :options="options"
              :confirm="false"
              @on-change="changeDate"
              type="date"
              multiple
              :editable="false"
              @on-ok="onOk"
              @on-clear="onClear"
              size="small"
              placeholder="请选择闭馆日期"

              v-model="closeDate1"
              class="remote"
            ></DatePicker>
            <Button
              class="quickly"
              type="success"
              size="large"
              @click="showmodel"
            >快捷设置
            </Button
            >
            <Modal
              v-model="modelshow2"
              title="批量设置闭馆日期"
              @on-ok="ok2"
              @on-cancel="cancels"
            >
              <Form>

                <div class="findtime">
                  <FormItem label="起止日期">
                    <DatePicker
                      :clearable="clearable"
                      format="yyyy-MM-dd"
                      type="daterange"
                      placeholder="请选择起止时间"
                      style="width: 200px"
                      :value="time2"
                      @on-change="onChange"
                    ></DatePicker
                    >
                  </FormItem>
                  <FormItem label="设置星期">
                    <div>
                      <el-checkbox-group v-model="checkboxGroup4" size="mini">
                        <el-checkbox-button
                          v-for="week in weeks"
                          :label="week"
                          :key="week"
                        >{{ week }}
                        </el-checkbox-button
                        >
                      </el-checkbox-group>
                    </div>
                  </FormItem>
                </div>
              </Form>
            </Modal>

            <Tooltip
              max-width="400"
              content="按每周常规闭馆日自动设置场馆闭馆日期，也可手动选择指定日期是否闭馆"
              placement="bottom"
            >
              <Icon
                style="margin-left: 10px; margin-top: 7px"
                size="20"
                type="ios-help-circle-outline"
              />
            </Tooltip>
          </FormItem>

          <!-- <FormItem label="限制预约省份：">
            <Select style="width: 100%" multiple v-model="data.provinceCode">
              <template v-for="item in provinceCodeList">
                <Option :value="item.code">{{ item.name }}</Option>
              </template>
            </Select>
          </FormItem> -->
          <FormItem label="限制预约城市：">
            <div>
              <!-- <div class="pro" v-for="item in provinceCode" :key="item">{{item.label}}</div> -->

              <el-tag
                v-for="tag in all"
                :key="tag.label"
                closable
                :type="tag.type"
                @close="handleClose(tag)"
              >
                {{ tag.label }}
              </el-tag>
            </div>
            <el-cascader
              :options="cityprovince"
              :props="{ multiple: true }"
              clearable
              @change="cityprovince2"
              style="width: 900px"
            ></el-cascader>
            <Tooltip
              max-width="400"
              content="可自主选择限制一个或多个地区游客的预约，可用于特殊限制场景，如疫情期间的中高风险地区防疫防控"
              placement="bottom"
            >
              <Icon
                style="margin-left: 10px; margin-top: 7px"
                size="20"
                type="ios-help-circle-outline"
              />
            </Tooltip>
          </FormItem>

          <FormItem label="屏蔽提示语：" v-if="data.provinceCode.length != 0">
            <Input style="width: 900px" v-model="data.shieldedTips"></Input>
            <Tooltip
              max-width="400"
              content="限制预约地区后，该地区游客进行预约时，会提示该设置提示语句。"
              placement="bottom"
            >
              <Icon
                style="margin-left: 10px; margin-top: 7px"
                size="20"
                type="ios-help-circle-outline"
              />
            </Tooltip>
          </FormItem>

          <FormItem label="到馆时间列表：">
            <template v-for="(item, key) in data.arrivalPavilions">
              <div style="display: flex; align-items: center">
                <TimePicker
                  transfer
                  format="HH:mm"
                  type="timerange"
                  :clearable="clearable"
                  placement="bottom-start"
                  placeholder="请选择时间"
                  style="width: 500px; margin: 5px 0"
                  v-model="item.time"
                ></TimePicker>
                <Icon
                  type="ios-close-circle-outline"
                  size="24"
                  @click="del(key)"
                  style="margin-left: 10px; cursor: pointer"
                />
              </div>
            </template>
            <Button
              type="warning"
              style="width: 100px; margin-top: 5px"
              @click="add"
            >添加一组
            </Button
            >
            <Tooltip
              max-width="400"
              content="添加设置到馆参观场次时间信息"
              placement="bottom"
            >
              <Icon
                style="margin-left: 10px; margin-top: 7px"
                size="20"
                type="ios-help-circle-outline"
              />
            </Tooltip>
          </FormItem>
          <Button
            type="success"
            size="large"
            style="width: 100%"
            @click="submit"
            :loading="spinShow2"
          >提交
          </Button
          >
        </Form>
      </el-tab-pane>
      <el-tab-pane label="健康申明">
        <p class="title">健康申明</p>
        <vue-tinymce
          :value="data.healthClaim"
          @catchData="catchData"
        ></vue-tinymce>
        <Button
          type="success"
          size="large"
          style="width: 100%; margin-top: 10px"
          @click="submit"
          :loading="spinShow2"
        >提交
        </Button
        >
      </el-tab-pane>
      <el-tab-pane label="健康申明问卷版">
        <Questionnaire :museumId="museumId" v-if="museumId"
                       :healthQuestionnaireSwitch="gonggaoData['healthQuestionnaireSwitch']"/>
      </el-tab-pane>
      <el-tab-pane label="预约公告">
        <p class="title">预约公告</p>
        <vue-tinymce
          :value="data.visitingInformation"
          @catchData="catchData2"
        ></vue-tinymce>
        <div
          style="
            display: flex;
            align-items: center;
            margin-top: 20px;
            margin-bottom: 10px;
          "
        >
          <p style="margin-right: 20px">是否弹出预约公告</p>
          <i-switch
            @on-change="onChangeSwitch"
            v-model="gonggaoData.popPlacard"
            size="large"
          >
            <span slot="open">弹出</span>
            <span slot="close">不弹</span>
          </i-switch>
        </div>
        <Button
          type="success"
          size="large"
          style="width: 100%; margin-top: 10px"
          @click="submit"
          :loading="spinShow2"
        >提交
        </Button
        >
      </el-tab-pane>
      <el-tab-pane label="讲解配置">
        <div class="leftbutton">
          <div style="width: 126px">
            <Button
              type="success"
              size="large"
              style="width: 100%; margin-top: 10px"
              @click="newxin"
              :loading="spinShow2"
            >新增讲解场次
            </Button
            >
            <el-dialog
              title="提示"
              :visible.sync="dialogFormVisible"
              :modal-append-to-body="false"
              :before-close="handleCloses"
            >
              <el-form :model="form">
                <el-form-item label="时间场次" :label-width="formLabelWidth">
                  <el-select
                    v-model="timeRangevalue"
                    placeholder="请选择时间场次"
                    @change="changetimerange($event)"
                  >
                    <el-option
                      v-for="item in form.region"
                      :key="item.id"
                      :label="item.timeRange"
                      :value="item.timeRange"
                    >
                    </el-option>
                  </el-select>
                </el-form-item>
                <el-form-item
                  label="是否开启讲解预约"
                  :label-width="formLabelWidth"
                >
                  <el-select v-model="form.trueorfalse" placeholder="请选择">
                    <el-option label="是" value="true"></el-option>
                    <el-option label="否" value="false"></el-option>
                  </el-select>
                </el-form-item>
                <el-form-item
                  label="可预约讲解次数"
                  :label-width="formLabelWidth"
                >
                  <el-input-number
                    v-model="num"
                    @change="handleChange"
                    :min="1"
                    label="描述文字"
                  ></el-input-number>
                </el-form-item>
              </el-form>
              <div slot="footer" class="dialog-footer">
                <el-button @click="dialogFormVisible = false">取 消</el-button>
                <el-button type="primary" @click="cfram()">确 定</el-button>
              </div>
            </el-dialog>
          </div>
        </div>
        <div class="jiangjielist">
          <el-table :data="tableData" style="width: 100%">
            <el-table-column label="时间场次" width="180">
              <template slot-scope="scope">
                <span style="margin-left: 10px">{{
                  scope.row.sessionTime
                }}</span>
              </template>
            </el-table-column>
            <el-table-column label="是否开启讲解预约" width="180">
              <template slot-scope="scope">
                <el-switch
                  v-model="scope.row.enableBook"
                  active-color="#13ce66"
                  inactive-color="#ff4949"
                  @change="changeswitch(scope)"
                >
                </el-switch>
              </template>
            </el-table-column>
            <el-table-column label="单场次可预约讲解次数" width="180">
              <template slot-scope="scope">
                <span style="margin-left: 10px">{{ scope.row.num }}</span>
              </template>
            </el-table-column>
            <el-table-column label="操作">
              <template slot-scope="scope">
                <el-button
                  size="mini"
                  @click="
                    (dialogFormVisibles = true),
                      handleEdit(scope.$index, scope.row)
                  "
                >编辑
                </el-button
                >
                <el-button
                  size="mini"
                  type="danger"
                  @click="handleDelete(scope.$index, scope.row)"
                >删除
                </el-button
                >
                <el-dialog
                  title="提示"
                  :visible.sync="findqq"
                  width="30%"
                  :modal-append-to-body="false"
                  :before-close="handleClose"
                >
                  <span>确认删除?</span>
                  <span slot="footer" class="dialog-footer">
                    <el-button @click="findqq = false">取 消</el-button>
                    <el-button type="primary" @click="queding">确 定</el-button>
                  </span>
                </el-dialog>
                <el-dialog
                  title="提示"
                  :visible.sync="dialogFormVisibles"
                  :modal-append-to-body="false"
                  :before-close="handleCloses"
                >
                  <el-form :model="form">
                    <el-form-item
                      label="时间场次"
                      :label-width="formLabelWidth"
                    >
                      <el-select
                        v-model="sessionTime"
                        placeholder="请选择时间场次"
                        @change="changetimerange($event)"
                      >
                        <el-option
                          v-for="item in form.region"
                          :key="item.id"
                          :label="item.timeRange"
                          :value="item.timeRange"
                        >
                        </el-option>
                      </el-select>
                    </el-form-item>
                    <el-form-item
                      label="是否开启讲解预约"
                      :label-width="formLabelWidth"
                    >
                      <el-select v-model="istruefalse" placeholder="请选择">
                        <el-option label="是" value="true"></el-option>
                        <el-option label="否" value="false"></el-option>
                      </el-select>
                    </el-form-item>
                    <el-form-item
                      label="可预约讲解次数"
                      :label-width="formLabelWidth"
                    >
                      <el-input-number
                        v-model="nums"
                        @change="handleChange"
                        :min="1"
                        label="描述文字"
                      ></el-input-number>
                    </el-form-item>
                  </el-form>
                  <div slot="footer" class="dialog-footer">
                    <el-button @click="dialogFormVisibles = false"
                    >取 消
                    </el-button
                    >
                    <el-button
                      type="primary"
                      @click="(dialogFormVisibles = false), cmo()"
                    >确 定
                    </el-button
                    >
                  </div>
                </el-dialog>
              </template>
            </el-table-column>
          </el-table>
        </div>
      </el-tab-pane>
    </el-tabs>

    <Modal
      title="温馨提示"
      :mask-closable="false"
      :closable="false"
      v-model="sureModal"
    >
      <p style="font-size: 20px; font-weight: bold; text-align: center">
        身份校验是游客预约时是否需提供身份信息。
      </p>
      <p style="font-size: 18px; font-weight: bold; text-align: center">
        如您要关闭，则游客预约时则只需填写姓名和手机号。
      </p>
      <div slot="footer">
        <Button type="warning" class="Button" @click="cancel">取消</Button>
        <Button type="success" class="Button" :loading="loading" @click="sureOk"
        >确认关闭
        </Button
        >
      </div>
    </Modal>

    <Modal
      title="温馨提示"
      :mask-closable="false"
      :closable="false"
      v-model="sureModal2"
    >
      <p style="font-size: 20px; font-weight: bold; text-align: center">
        健康码校验是游客预约时是否通过健康码接口验证。
      </p>
      <p style="font-size: 18px; font-weight: bold; text-align: center">
        如您要关闭，则游客预约时将不校验健康数据。
      </p>
      <div slot="footer">
        <Button type="warning" class="Button" @click="cancel2">取消</Button>
        <Button
          type="success"
          class="Button"
          :loading="loading2"
          @click="sureOk2"
        >确认关闭
        </Button
        >
      </div>
    </Modal>

    <Modal
      title="温馨提示"
      :mask-closable="false"
      :closable="false"
      v-model="sureModal3"
    >
      <p style="font-size: 20px; font-weight: bold; text-align: center">
        多次入园是指游客是否可以在有效时间段内多次进出。
      </p>
      <p style="font-size: 18px; font-weight: bold; text-align: center">
        如您要关闭，则游客在第一次核验后，将无法再次核验。
      </p>
      <div slot="footer">
        <Button type="warning" class="Button" @click="cancel3">取消</Button>
        <Button
          type="success"
          class="Button"
          :loading="loading3"
          @click="sureOk3"
        >确认关闭
        </Button
        >
      </div>
    </Modal>
  </div>
</template>

<script>
  import Questionnaire from './Questionnaire'

  export default {
    components: {Questionnaire},
    data () {
      return {
        checkboxGroup4: [],
        weeks: ['周一', '周二', '周三', '周四', '周五', '周六', '周日'],
        clearable: false,
        time: [],
        modelshow2: false,
        time2: [],

        tableData: [],
        spinShow1: false,
        spinShow2: false,
        loading: false,
        loading2: false,
        loading3: false,
        loading4: false,
        museumId: '',
        museumList: [],
        form: {
          phonenum: '',
          region: [],
          trueorfalse: [],
        },
        timeRangevalue: '',
        sessionTime: '',
        trueorfalse: '',
        istruefalse: '',
        num: 1,
        nums: '',
        updateBookSuccessTops: '',
        dialogFormVisible: false,
        dialogFormVisibles: false,
        formLabelWidth: '160px',
        clearable: false,
        sureModal: false,
        sureModal2: false,
        sureModal3: false,
        sureModal4: false,
        closeDate1: [],
        closeDate2: [],
        closeDate3: [],
        closeDate4: [],
        provinceCode1: [],
        provinceCode: [],
        provalue: [],
        getvalue: [],
        vide: [],
        findqq: false,
        FormVisible: false,
        all: [],
        allcity: [],
        provaluecode: [],
        provinceCodeList: [],
        cityprovince: [],
        coll: false,
        gonggaoData: {},
        teamAdvanceDays: 0,
        newArr: [],
        extraconfig: [],
        data: {
          enableAppointmentThatDay: false,
          travelCheckFlag: false,
          autoBookSwitch: false,
          selfCheckSwitch: false,
          repeatBookSwitch: false,
          arrivalPavilions: [],
          closeWeek: [],
          singleLimit: 0,
          healthClaim: '',
          visitingInformation: '',
          checkDelay: 0,
          showAdvanceTime: 0,
          leaveFlag: false,
          id: '',
          showProvinceHealthCodeFlag: false,
          provinceHealthCodeFlag: false,
          provinceCode: [],
          shieldedTips: '',
        },
        list: [
          {value: '1', label: '周一'},
          {value: '2', label: '周二'},
          {value: '3', label: '周三'},
          {value: '4', label: '周四'},
          {value: '5', label: '周五'},
          {value: '6', label: '周六'},
          {value: '7', label: '周七'},
        ],

        options: {
          disabledDate (date) {
            return date && date.valueOf() < Date.now() - 86400000
          },
        },
      }
    },
    created () {
      this.getProvincecity()
      if (this.$store.state.superAdmin == 'true') {
        this.getAppMuseumExtraConfig()
        this.getMuseumList()
      } else {
        if (this.$store.state.museums.length > 1) {
          this.museumId = this.$store.state.museumId
          this.getExplainConfig()
        } else {
          this.museumId = ''
          this.getExplainConfig()
        }
        this.getcity()
        this.getAppMuseumExtraConfig()
      }
      this.getProvince()
    },
    methods: {
      getAppMuseumExtraConfig () {
        console.log(this.museumId)
        this.$http(
          '/stage/reservation/getAppMuseumExtraConfig',
          {
            museumId: this.museumId,
          },
          'get',
          (res) => {
            this.gonggaoData = res.data.data
            this.updateBookSuccessTops = res.data.data.bookSuccessTips
            console.log(this.updateBookSuccessTops)
            console.log(this.gonggaoData)
          }
        )
      },
      onChangeSwitch (data) {
        console.log(this.gonggaoData.id)
        this.$http(
          '/stage/reservation/enableOrDisablePopPlacardSwitch',
          {
            id: this.gonggaoData.id,
          },
          'post',
          (res) => {
            this.$Message.success('设置成功')
          }
        )
      },
      // 获取省份
      getProvince () {
        this.$http('/stage/reservation/getProvince', {}, 'get', (res) => {
          this.provinceCodeList = res.data.data
        })
      },
      getcity () {
        this.$http('/stage/reservation/getAllCity', {}, 'get', (res) => {
          console.log(res)
          console.log(res.data.data)
          this.allcity = res.data.data
          this.getReservationConfig()
        })
      },
      // 闭馆日期操作
      getClosedSettingByMonth () {
        this.$http(
          '/stage/reservation/getClosedSettingByMonth',
          {
            appMuseumId: this.museumId,
            month: '',
          },
          'post',
          (res) => {
            let arr = []
            for (let i = 0; i < res.data.data.length; i++) {
              arr.push(res.data.data[i].closeDate)
            }
            this.closeDate1 = arr.join(',')
            this.closeDate2 = arr
          }
        )
      },
      showmeteam () {
        console.log(1233213123123131)
        this.$http(
          '/stage/reservation/getCalendarCloseTeam',
          {
            museumId: this.museumId,
          },
          'post',
          (res) => {
            let arr = []
            for (let i = 0; i < res.data.data.length; i++) {
              arr.push(res.data.data[i].dateClose)
            }

            this.closeDate3 = arr
            console.log(arr)
            console.log(this.closeDate3)
            this.closeDate4 = arr
          }
        )
        this.$http(
          '/stage/reservation/getAppMuseumExtraConfig',
          {
            museumId: this.museumId,
          },
          'get',
          (res) => {
            this.teamAdvanceDays = res.data.data.teamAdvanceDays
            console.log(this.teamAdvanceDays)
            console.log(res.data.data)
            console.log(res.data)
            this.extraconfig = res.data.data
            this.extraconfig.openTeamAppointment = this.extraconfig.openTeamAppointment ? '开启' : '关闭'
            console.log(this.extraconfig.teamNotifySwitch)
            this.extraconfig.teamNotifySwitch = this.extraconfig.teamNotifySwitch ? '开启' : '关闭'
            this.extraconfig.hasCommentService = this.extraconfig.hasCommentService ? '开启' : '关闭'
            this.extraconfig.simpleTeamBookSwitch = this.extraconfig.simpleTeamBookSwitch ? '开启' : '关闭'
          }
        )
        this.FormVisible = true
      },
      quedingteam () {
        if (this.extraconfig.teamNotifySwitch == '开启') {
          if (this.extraconfig.notifyPhone == '') {
            // this.reload();
            this.$message.error('请输入通知手机号')
            return
          } else {
            if (
              !/^[1](([3][0-9])|([4][5-9])|([5][0-3,5-9])|([6][5,6])|([7][0-8])|([8][0-9])|([9][1,8,9]))[0-9]{8}$/.test(
                this.extraconfig.notifyPhone
              )
            ) {
              this.$message.error('手机号码有误，请重填')

              return false
            }
          }
        }
        // 没有开启团队预约 不知道为什么要加 也不让删 就先注释了
        // else {
        //   if (this.extraconfig.notifyPhone == '') {
        //     // this.reload();
        //
        //   } else if (
        //     !/^[1](([3][0-9])|([4][5-9])|([5][0-3,5-9])|([6][5,6])|([7][0-8])|([8][0-9])|([9][1,8,9]))[0-9]{8}$/.test(
        //       this.extraconfig.notifyPhone
        //     )
        //   ) {
        //     this.$message.error('手机号码有误，请重填')
        //
        //     return false
        //   }
        // }
        let openTeamAppointment = this.extraconfig.openTeamAppointment === '开启'
        let teamNotifySwitch = this.extraconfig.teamNotifySwitch == '开启'
        let hasCommentService = this.extraconfig.hasCommentService == '开启'
        let simpleTeamBookSwitch = this.extraconfig.simpleTeamBookSwitch === '开启'
        this.$http(
          '/stage/reservation/addCalendarCloseTeam',
          {
            notifyPhone: this.extraconfig.notifyPhone,
            closeDates: this.closeDate4,
            museumId: this.museumId,
            teamAdvanceDays: this.teamAdvanceDays,
            hasCommentService,
            openTeamAppointment,
            simpleTeamBookSwitch,
            teamNotifySwitch,
            teamLimitMin: this.extraconfig.teamLimitMin,
            teamLimitMax: this.extraconfig.teamLimitMax

          },
          'post',
          (res) => {
            if (res.data.code != '200') {
              this.$message({
                message: res.data.msg,
                type: 'error',
              })
              return
            }
            let arr = []
            for (let i = 0; i < res.data.data.length; i++) {
              arr.push(res.data.data[i].closeDate)
            }
            this.closeDate3 = arr.join(',')
            this.closeDate4 = arr.join(',')
            this.$message({
              message: '修改成功',
              type: 'success',
            })
            this.FormVisible = false
          }
        )
      },
      changeDate (data) {
        this.closeDate1 = data
      },
      changeDates (data) {
        console.log(data.split(','))
        this.closeDate4 = data.split(',')
      },
      saveClosedSetting (date) {
        this.$http(
          '/stage/reservation/saveClosedSetting',
          {
            appMuseumId: this.museumId,
            closeDate: date,
            closeMonth: date.substring(0, 7),
          },
          'post',
          (res) => {
          }
        )
      },
      cancelClosedSetting (date) {
        this.$http(
          '/stage/reservation/cancelClosedSetting',
          {
            appMuseumId: this.museumId,
            closeDate: date,
          },
          'post',
          (res) => {
          }
        )
      },
      saveClose () {
        let arr1 = [],
          arr2 = [],
          arr3 = this.closeDate1.split(',')
        for (let i = 0; i < this.closeDate2.length; i++) {
          if (arr3.indexOf(this.closeDate2[i]) == -1) {
            arr1.push(this.closeDate2[i])
          }
        }
        for (let i = 0; i < arr3.length; i++) {
          if (this.closeDate2.indexOf(arr3[i]) == -1) {
            arr2.push(arr3[i])
          }
        }
        for (let i = 0; i < arr1.length; i++) {
          this.cancelClosedSetting(arr1[i])
        }
        for (let i = 0; i < arr2.length; i++) {
          this.saveClosedSetting(arr2[i])
        }
      },
      emptyClosedSetting () {
        this.$http(
          '/stage/reservation/emptyClosedSetting',
          {
            appMuseumId: this.museumId,
          },
          'get',
          (res) => {
            this.getClosedSettingByMonth()
          }
        )
      },
      onClear () {
        this.$Modal.confirm({
          title: '提示',
          content: '<p>确定要清空所有闭馆日期吗？</p>',
          onOk: () => {
            this.closeDate1 = []
            this.emptyClosedSetting()
          },
          onCancel: () => {
            this.getClosedSettingByMonth()
          },
        })
      },
      onOk () {
        this.saveClose()
      },

      // 取消关闭
      cancel () {
        this.getReservationConfig()
        this.sureModal = false
      },
      // 确认关闭
      sureOk () {
        this.loading = true
        this.$http(
          '/stage/reservation/enableOrDisableFillIdCardFlag',
          {
            museumId: this.museumId,
          },
          'get',
          (res) => {
            if (res.data.code == 200) {
              this.sureModal = false
              this.getReservationConfig()
            } else {
              this.$Message.error(res.data.msg)
            }
            this.loading = false
          }
        )
      },
      // 改变身份校验
      changeEnable () {
        if (!this.data.mustFillIdCard) {
          this.sureModal = true
          return false
        }
        this.$http(
          '/stage/reservation/enableOrDisableFillIdCardFlag',
          {
            museumId: this.museumId,
          },
          'get',
          (res) => {
            if (res.data.code == 200) {
              this.getReservationConfig()
            } else {
              this.$Message.error(res.data.msg)
            }
          }
        )
      },

      // 取消关闭
      cancel2 () {
        this.getReservationConfig()
        this.sureModal2 = false
      },
      // 确认关闭
      sureOk2 () {
        this.loading2 = true
        this.$http(
          '/stage/reservation/enableOrDisableHealthCode',
          {
            museumId: this.museumId,
          },
          'get',
          (res) => {
            if (res.data.code == 200) {
              this.sureModal2 = false
              this.getReservationConfig()
            } else {
              this.$Message.error(res.data.msg)
            }
            this.loading2 = false
          }
        )
      },
      // 改变健康码校验
      changeHealthCodeFlag () {
        if (!this.data.healthCodeFlag) {
          this.sureModal2 = true
          return false
        }
        this.$http(
          '/stage/reservation/enableOrDisableHealthCode',
          {
            museumId: this.museumId,
          },
          'get',
          (res) => {
            if (res.data.code == 200) {
              this.getReservationConfig()
            } else {
              this.$Message.error(res.data.msg)
            }
          }
        )
      },

      // 取消关闭
      cancel3 () {
        this.getReservationConfig()
        this.sureModal3 = false
      },
      // 确认关闭
      sureOk3 () {
        this.loading3 = true
        this.$http(
          '/stage/reservation/enableOrDisableMultipleEnterFlag',
          {
            museumId: this.museumId,
          },
          'get',
          (res) => {
            if (res.data.code == 200) {
              this.sureModal3 = false
              this.getReservationConfig()
            } else {
              this.$Message.error(res.data.msg)
            }
            this.loading3 = false
          }
        )
      },
      changeMultipleEnterFlag () {
        if (!this.data.multipleEnterFlag) {
          this.sureModal3 = true
          return false
        }
        this.$http(
          '/stage/reservation/enableOrDisableMultipleEnterFlag',
          {
            museumId: this.museumId,
          },
          'get',
          (res) => {
            if (res.data.code == 200) {
              this.getReservationConfig()
            } else {
              this.$Message.error(res.data.msg)
            }
          }
        )
      },

      // 留言功能
      changeLeaveFlag (data) {
        this.data.leaveFlag = data
        this.submit()
      },

      // 浙江省健康码开关
      changeProvinceHealth () {
        this.spinShow1 = true
        this.$http(
          '/stage/reservation/enableOrDisableProvinceHealthCode',
          {
            museumId: this.museumId,
          },
          'get',
          (res) => {
            if (res.data.code == 200) {
              this.$Message.success('操作成功！')
              this.getReservationConfig()
            } else {
              this.$Message.error(res.data.msg)
            }
            this.spinShow1 = false
          }
        )
      },

      getMuseumList () {
        this.spinShow1 = true
        this.$http('/stage/museum/getAppMuseumDropDown', {}, 'post', (res) => {
          if (res.data.code == 200) {
            this.museumList = res.data.data
            for (let i = 0; i < this.museumList.length; i++) {
              if (this.museumList[i].name.length > 20) {
                this.museumList[i].name =
                  this.museumList[i].name.slice(0, 20) + '...'
              }
            }
            this.museumId = this.museumList[0].id
            console.log(this.museumId)
            // this.getReservationConfig();
            this.getcity()
            this.getAppMuseumExtraConfig()
            this.getExplainConfig()
          } else {
            this.$Message.error(res.data.msg)
          }
        })
      },
      getExplainConfig () {
        console.log('到底调用了没有')
        this.$http(
          '/stage/explainConfig/getExplainConfig',
          {
            museumId: this.museumId,
          },
          'post',
          (res) => {
            console.log(res)
            this.tableData = res.data.data
          }
        )
      },
      getReservationConfig () {
        this.getClosedSettingByMonth()
        this.spinShow1 = true
        this.$http(
          '/stage/reservation/getReservationConfig',
          {
            museumId: this.museumId,
          },
          'get',
          (res) => {
            console.log(res.data.code)
            if (res.data.code == 200) {
              if (res.data.data.enableAppointmentThatDay == undefined) {
                this.data.enableAppointmentThatDay = false
              } else {
                this.data.enableAppointmentThatDay =
                  res.data.data.enableAppointmentThatDay
              }
              if (res.data.data.travelCheckFlag == undefined) {
                this.data.travelCheckFlag = false
              } else {
                this.data.travelCheckFlag = res.data.data.travelCheckFlag
              }
              if (res.data.data.autoBookSwitch == undefined) {
                this.data.autoBookSwitch = false
              } else {
                this.data.autoBookSwitch = res.data.data.autoBookSwitch
              }
              if (res.data.data.selfCheckSwitch == undefined) {
                this.data.selfCheckSwitch = false
              } else {
                this.data.selfCheckSwitch = res.data.data.selfCheckSwitch
              }
              if (res.data.data.repeatBookSwitch == undefined) {
                this.data.repeatBookSwitch = false
              } else {
                this.data.repeatBookSwitch = res.data.data.repeatBookSwitch
              }

              if (res.data.data.mustFillIdCard == undefined) {
                this.data.mustFillIdCard = false
              } else {
                this.data.mustFillIdCard = res.data.data.mustFillIdCard
              }
              if (res.data.data.healthCodeFlag == undefined) {
                this.data.healthCodeFlag = false
              } else {
                this.data.healthCodeFlag = res.data.data.healthCodeFlag
              }
              if (res.data.data.leaveFlag == undefined) {
                this.data.leaveFlag = false
              } else {
                this.data.leaveFlag = res.data.data.leaveFlag
              }
              if (res.data.data.multipleEnterFlag == undefined) {
                this.data.multipleEnterFlag = false
              } else {
                this.data.multipleEnterFlag = res.data.data.multipleEnterFlag
              }
              if (res.data.data.multipleEnterFlag == undefined) {
                this.data.showProvinceHealthCodeFlag = false
              } else {
                this.data.showProvinceHealthCodeFlag =
                  res.data.data.showProvinceHealthCodeFlag
              }
              if (res.data.data.provinceHealthCodeFlag == undefined) {
                this.data.provinceHealthCodeFlag = false
              } else {
                this.data.provinceHealthCodeFlag =
                  res.data.data.provinceHealthCodeFlag
              }
              if (res.data.data.provinceCode == undefined) {
                this.data.provinceCode = []
              } else {
                if (res.data.data.provinceCode == '') {
                  this.data.provinceCode = []
                } else {
                  this.data.provinceCode = res.data.data.provinceCode.split(',')
                  console.log(this.data.provinceCode)
                  this.provinceCode1 = res.data.data.provinceCode.split(',')
                  console.log(this.provinceCode1)
                  console.log(11111)
                  var all = []
                  console.log(this.allcity)
                  for (var i = 0; i < this.allcity.length; i++) {
                    for (var j = 0; j < this.data.provinceCode.length; j++) {
                      if (this.allcity[i].code == this.data.provinceCode[j]) {
                        all.push(this.allcity[i])
                      }
                    }
                  }
                  console.log(all)
                  console.log(22222)
                  all.forEach((e) => {
                    e.label = e.name
                  })
                  this.all = all
                  console.log(all)
                }
              }
              if (res.data.data.arrivalPavilions == undefined) {
                this.data.arrivalPavilions = []
              } else {
                this.data.arrivalPavilions = []
                for (let i = 0; i < res.data.data.arrivalPavilions.length; i++) {
                  this.data.arrivalPavilions.push({
                    time: [
                      res.data.data.arrivalPavilions[i].split('-')[0],
                      res.data.data.arrivalPavilions[i].split('-')[1],
                    ],
                  })
                }
              }
              if (res.data.data.singleLimit == undefined) {
                this.data.singleLimit = ''
              } else {
                this.data.singleLimit = res.data.data.singleLimit
              }
              if (res.data.data.shieldedTips == undefined) {
                this.data.shieldedTips = ''
              } else {
                this.data.shieldedTips = res.data.data.shieldedTips
              }
              if (res.data.data.checkDelay == undefined) {
                this.data.checkDelay = 0
              } else {
                this.data.checkDelay = res.data.data.checkDelay
              }
              if (res.data.data.showAdvanceTime == undefined) {
                this.data.showAdvanceTime = 0
              } else {
                this.data.showAdvanceTime = res.data.data.showAdvanceTime
              }
              if (res.data.data.closeWeek == undefined) {
                this.data.closeWeek = []
              } else {
                this.data.closeWeek = res.data.data.closeWeek.split(',')
              }
              if (res.data.data.healthClaim == undefined) {
                this.data.healthClaim = ''
              } else {
                this.data.healthClaim = res.data.data.healthClaim
              }
              if (res.data.data.visitingInformation == undefined) {
                this.data.visitingInformation = ''
              } else {
                this.data.visitingInformation = res.data.data.visitingInformation
              }
              if (res.data.data.id == undefined) {
                this.data.id = ''
              } else {
                this.data.id = res.data.data.id
              }
            } else {
              this.$Message.error(res.data.msg)
            }
            this.spinShow1 = false
          }
        )
      },
      submit () {
        for (let i = 0; i < this.data.arrivalPavilions.length; i++) {
          if (this.data.arrivalPavilions[i].time[0] == '') {
            this.$Message.error('到馆时间列表不能为空')
            return false
          }
        }

        let arrivalPavilions = [],
          closeWeek = ''
        if (this.data.arrivalPavilions.length != 0) {
          for (let i = 0; i < this.data.arrivalPavilions.length; i++) {
            arrivalPavilions.push(
              this.data.arrivalPavilions[i].time[0] +
              '-' +
              this.data.arrivalPavilions[i].time[1]
            )
          }
        }
        if (this.data.closeWeek.length != 0) {
          closeWeek = this.data.closeWeek.join(',')
        }
        if (this.data.provinceCode.length != 0) {
          if (this.data.shieldedTips == '') {
            this.$Message.error('屏蔽提示语不能为空')
            return false
          }
        }
        this.spinShow2 = true
        console.log(this.x)
        console.log(this.provinceCode1)
        // console.log(this.x==undefined?this.provinceCode1:this.provinceCode1.concat(this.x))
        console.log(
          this.x == undefined
            ? this.provinceCode1
            : this.provinceCode1.concat(this.x)
        )
        var ubde =
          this.x == undefined
            ? this.provinceCode1
            : this.provinceCode1.concat(this.x)
        var newArr = []
        for (var i = 0; i < ubde.length; i++) {
          if (newArr.indexOf(ubde[i]) === -1) {
            newArr.push(ubde[i])
          }
        }
        this.$http(
          '/stage/reservation/updateBookSuccessTops',
          {
            bookSuccessTips: this.updateBookSuccessTops,
            museumId: this.museumId,
          },
          'post',
          (res) => {
            if (res.data.code == 200) {
              // this.$router.go(0);
            } else {
              this.$Message.error(res.data.msg)
              return
            }
          }
        )
        this.$http(
          '/stage/reservation/updateReservation',
          {
            arrivalPavilions: arrivalPavilions,
            closeWeek: closeWeek,
            enableAppointmentThatDay: this.data.enableAppointmentThatDay,
            healthClaim: this.data.healthClaim,
            singleLimit: this.data.singleLimit,
            visitingInformation: this.data.visitingInformation,
            checkDelay: this.data.checkDelay,
            showAdvanceTime: this.data.showAdvanceTime,
            leaveFlag: this.data.leaveFlag,
            provinceCode: newArr.toString(),
            shieldedTips: this.data.shieldedTips,
            travelCheckFlag: this.data.travelCheckFlag,
            autoBookSwitch: this.data.autoBookSwitch,
            selfCheckSwitch: this.data.selfCheckSwitch,
            repeatBookSwitch: this.data.repeatBookSwitch,
            id: this.data.id,
          },
          'post',
          (res) => {
            if (res.data.code == 200) {
              this.$Message.success('提交成功')
              this.getReservationConfig()
              // this.$router.go(0);
            } else {
              this.$Message.error(res.data.msg)
            }
            this.spinShow2 = false
          }
        )
      },
      catchData (data) {
        this.data.healthClaim = data
      },
      catchData2 (data) {
        this.data.visitingInformation = data
      },
      add () {
        this.data.arrivalPavilions.push({time: ''})
      },
      del (data) {
        let arr = []
        for (let i = 0; i < this.data.arrivalPavilions.length; i++) {
          if (i != data) {
            arr.push(this.data.arrivalPavilions[i])
          }
        }
        this.data.arrivalPavilions = arr
      },
      getProvincecity () {
        this.$http('/stage/museum/cascadeProvinceCity', {}, 'post', (res) => {
          console.log(res.data)
          console.log(res.data.data)
          this.cityprovince = res.data.data
          this.cityprovince.forEach((e) => {
            e.value = e.code
            e.label = e.name
            e.children = e.cities
            e.children.forEach((e) => {
              e.label = e.name
              e.value = e.code
              delete e.cities
              delete e.name
              delete e.code
            })
            delete e.cities
            delete e.name
            delete e.code
          })
          console.log(this.cityprovince)
        })
      },
      cityprovince2 (data) {
        console.log(data)
        console.log(data.toString())
        this.data.provinceCode = data.toString()
        console.log(this.data.provinceCode)
        console.log(this.data.provinceCode.split(','))
        data = this.data.provinceCode.split(',')
        console.log(data)
        var a = [
          '1100',
          '1200',
          '1300',
          '1400',
          '1500',
          '2100',
          '2200',
          '2300',
          '3100',
          '3200',
          '3300',
          '3400',
          '3500',
          '3600',
          '3700',
          '4100',
          '4200',
          '4300',
          '4400',
          '4500',
          '4600',
          '5000',
          '5100',
          '5200',
          '5300',
          '5400',
          '6100',
          '6200',
          '6300',
          '6400',
          '6500',
          '7100',
          '8100',
          '8200',
          '000000',
        ]
        var x = []
        for (var i = 0; i < data.length; i++) {
          if (a.indexOf(data[i]) == -1) {
            console.log(data[i])
            x.push(data[i])
          }
        }
        console.log(x)
        this.x = x
      },
      handleClose (tag) {
        console.log(this.all)
        console.log(tag)
        console.log(this.provinceCode1)
        this.all.splice(this.all.indexOf(tag), 1)
        console.log(this.provinceCode1.indexOf(tag.value))
        this.provinceCode1.splice(this.provinceCode1.indexOf(tag.code), 1)
        console.log(this.provinceCode1)

        // var provalue = [];
        // this.data.provaluecode.forEach((e) => {
        //   provalue.push(e);
        // });
        // console.log(provalue);
        // this.provalue = provalue;
      },
      handleChange (value) {
        console.log(value)
      },
      newxin () {
        this.dialogFormVisible = true
        this.getReservationMuseumArrivalRangeDropdown()
      },
      getReservationMuseumArrivalRangeDropdown () {
        this.$http(
          '/stage/explainConfig/getReservationMuseumArrivalRangeDropdown',
          {
            museumId: this.museumId,
          },
          'get',
          (res) => {
            console.log(res)
            console.log(res.data.data)
            this.form.region = res.data.data
            console.log(this.form.region)
          }
        )
      },
      changetimerange () {
        console.log(this.timeRangevalue)
      },
      cfram () {
        // console.log(this.form.phonenum);
        console.log(this.timeRangevalue)
        console.log(this.form.trueorfalse)
        console.log(this.num)
        this.saveExplainConfig()
      },
      saveExplainConfig () {
        if (this.timeRangevalue == '') {
          this.$message({
            message: '请选择时间场次',
            type: 'warning',
          })
          return
        }
        if (this.form.trueorfalse == '') {
          this.$message({
            message: '请选择是否开启讲解预约',
            type: 'warning',
          })
          return
        }

        this.$http(
          '/stage/explainConfig/saveExplainConfig',
          {
            enableBook: this.form.trueorfalse,
            museumId: this.museumId,
            num: this.num,
            sessionTime: this.timeRangevalue,
          },
          'POST',
          (res) => {
            console.log(res)

            if (res.data.code == 4005) {
              this.$message({
                message: res.data.msg,
                type: 'warning',
              })

              return
            }
            this.form.trueorfalse = ''
            this.timeRangevalue = ''
            this.num = 1
            this.getExplainConfig()
            this.dialogFormVisible = false
          }
        )
      },
      handleEdit (index, row) {
        this.getReservationMuseumArrivalRangeDropdown()
        console.log(index, row)
        this.sessionTime = row.sessionTime
        if (row.enableBook == false) {
          this.istruefalse = '否'
        } else {
          this.istruefalse = '是'
        }

        this.showid = row.id
        this.nums = row.num
      },
      handleDelete (index, row) {
        console.log(index, row)
        this.showidd = row.id
        this.findqq = true
      },
      changeswitch (scope) {
        console.log(scope.row.id)
        console.log(scope.row.enableBook)
        this.$http(
          '/stage/explainConfig/enableOrDisableExplainConfig',
          {
            id: scope.row.id,
          },
          'POST',
          (res) => {
            console.log(res)
            this.getExplainConfig()
          }
        )
      },
      cmo () {
        console.log(this.istruefalse)
        if (this.istruefalse == '是') {
          this.istruefalse = true
        } else if (this.istruefalse == '否') {
          this.istruefalse = false
        }
        console.log(this.istruefalse)
        this.$http(
          '/stage/explainConfig/updateExplainConfig',
          {
            enableBook: this.istruefalse,
            id: this.showid,
            museumId: this.museumId,
            num: this.nums,
            sessionTime: this.sessionTime,
          },
          'POST',
          (res) => {
            console.log(res)
            this.getExplainConfig()
          }
        )
      },
      handleCloses () {
        this.dialogFormVisible = false
        this.dialogFormVisibles = false
        this.form.trueorfalse = ''
        this.timeRangevalue = ''
        this.num = 1
      },
      queding () {
        (this.findqq = false),
          this.$http(
            '/stage/explainConfig/deleteExplainConfig',
            {
              id: this.showidd,
            },
            'POST',
            (res) => {
              console.log(res)
              this.$message({
                message: '删除成功',
                type: 'success',
              })
              this.getExplainConfig()
            }
          )
      },
      nucleicSwitch () {
        this.$http(
          '/stage/reservation/enableOrDisableNucleicSwitch',
          {
            museumId: this.museumId,
          },
          'get',
          (res) => {
            console.log(res)
            this.$message({
              message: '切换成功',
              type: 'success',
            })
            this.getExplainConfig()
            this.getAppMuseumExtraConfig()
          }
        )
      },
      showmodel () {
        this.modelshow2 = true
      },
      onChange (data) {
        console.log(data)
        this.time2 = data
        console.log(this.checkboxGroup4)
      },
      ok2 () {

        if (this.time2.length == 0) {
          this.$Message.error('请选择日期')
          this.checkboxGroup4 = []

          this.time2 = []
          return
        }
        console.log('ok')
        console.log(this.checkboxGroup4)
        console.log(this.museumId)
        console.log(this.time)

        console.log(this.checkboxGroup4)
        var time = JSON.parse(JSON.stringify(this.time))

        var checkboxGroup4 = JSON.parse(JSON.stringify(this.checkboxGroup4))
        var checkbox = []
        for (let k = 0; k < checkboxGroup4.length; k++) {
          checkbox.push(checkboxGroup4[k].replace('周', ''))
        }
        console.log(checkbox)
        for (let l = 0; l < checkbox.length; l++) {
          if (checkbox[l] == '一') {
            checkbox[l] = 1
          } else if (checkbox[l] == '二') {
            checkbox[l] = 2
          } else if (checkbox[l] == '三') {
            checkbox[l] = 3
          } else if (checkbox[l] == '四') {
            checkbox[l] = 4
          } else if (checkbox[l] == '五') {
            checkbox[l] = 5
          } else if (checkbox[l] == '六') {
            checkbox[l] = 6
          } else if (checkbox[l] == '日') {
            checkbox[l] = 7
          }
        }
        console.log(time, checkbox)

        this.$http(
          '/stage/reservation/batchSaveClosedSetting',
          {
            museumId: this.museumId,
            end: this.time2[1],
            begin: this.time2[0],
            weeks: checkbox,
          },
          'post',
          (res) => {
            this.modelshow = false
            console.log(res)
            console.log(res.data.code)
            if (res.data.code == 200) {
              this.$Message.success('修改成功')
              this.getClosedSettingByMonth()
            } else {
              this.$Message.error(res.data.msg)
            }

            this.checkboxGroup4 = []

            this.time2 = []
          }
        )
      },
      cancels () {
        this.modelshow = false
        this.checkboxGroup4 = []

        this.time2 = []
      },
    },
  }
</script>

<style scoped>
  .title {
    text-align: center;
    line-height: 50px;
    font-weight: bold;
    font-size: 24px;
  }

  .pro {
    display: inline-block;
    padding: 0 4px;
    border: 1px solid #eee;
    margin-right: 5px;
    margin-bottom: 2px;
  }

  .leftbutton {
    width: 100%;
    display: flex;
    justify-content: flex-end;
  }

  .el-select {
    width: 400px;
  }

  .el-input-number /deep/ .el-input input {
    height: 40px;
    margin-top: -2px;
  }

  .fixed {
    display: flex;
    flex-wrap: wrap;

    width: 100%;
  }

  .formitem {
    width: 33%;
  }

  .remote {
    width: 900px;

  }

  .remote /deep/ input {
    padding-right: 30px;
  }

  .remote /deep/ span {
    line-height: 35px;
  }
</style>
